home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / javax / swing / SingleSelectionModel.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  1.7 KB  |  68 lines  |  [TEXT/CWIE]

  1. /*
  2.  * %W% %E%
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package javax.swing;
  16.  
  17. import javax.swing.event.*;
  18.  
  19. /**
  20.  * A model that supports at most one indexed selection.
  21.  *
  22.  * @version %I% %G%
  23.  * @author Dave Moore
  24.  */
  25. public interface SingleSelectionModel {
  26.     /**
  27.      * Returns the model's selection.
  28.      *
  29.      * @return  the model's selection, or -1 if there is no selection
  30.      * @see     #setSelectedIndex
  31.      */
  32.     public int getSelectedIndex();
  33.  
  34.     /**
  35.      * Sets the model's selected index to <I>index</I>.
  36.      *
  37.      * Notifies any listeners if the model changes
  38.      *
  39.      * @param an int specifying the model selection
  40.      * @see   #getSelectedIndex
  41.      * @see   #addChangeListener
  42.      */
  43.     public void setSelectedIndex(int index);
  44.  
  45.     /**
  46.      * Clears the selection (to -1).
  47.      */
  48.     public void clearSelection();
  49.  
  50.     /**
  51.      * Returns true if the selection model currently has a selected value.
  52.      * @return true if a value is currently selected
  53.      */
  54.     public boolean isSelected();
  55.  
  56.     /**
  57.      * Adds <I>listener</I> as a listener to changes in the model.
  58.      * @param l the ChangeListener to add
  59.      */
  60.     void addChangeListener(ChangeListener listener);
  61.  
  62.     /**
  63.      * Removes <I>listener</I> as a listener to changes in the model.
  64.      * @param l the ChangeListener to remove
  65.      */
  66.     void removeChangeListener(ChangeListener listener);
  67. }
  68.